<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    function SuperType1(name){
        this.name1 = name;
        this.color = ['red','blue','green'];
    }

    SuperType1.prototype.sayName = function(){
        alert(this.name1);
    };

    function SuperType2(name){
        this.name2 = name;
        this.color = ['red','blue','green'];
    }

    SuperType2.prototype.sayName = function(){
        alert(this.name2);
    };

    function SubType(name,age){
        SuperType1.call(this,name);
        SuperType2.call(this,name);
        this.age = age;
    }

    function inheritPrototype(subType,superType){
        var prototype = Object.create(superType.prototype);
        prototype.constructor = subType;
        subType.prototype = prototype;
    }

    inheritPrototype(SuperType1,SuperType2);
    inheritPrototype(SubType,SuperType1);

    SubType.prototype.sayAge = function(){
        alert(this.age);
    };

    var x = new SubType;
    console.log(x,x instanceof SuperType1);


    function a1(){
        this.name1 = 'wei';
        this.user1 = 'yi';
    }

    function a2(){
        this.name2 = 'wei';
        this.user2 = 'yi';
    }

    function a3(){
        this.name3 = 'wei';
        this.user3 = 'yi';
    }

    a2.prototype = new a3;
    a2.prototype.constructor = a2;
    a1.prototype = new a2;
    a1.prototype.constructor = a1;

    console.log(new a1);


    var name1 = {
        user: 0
    };
    //    $observe('name.user',12345);
//    name.user = 12345;
    console.log(name1);
</script>
</body>
</html>